{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "#-*-coding=utf-8-*-\n",
    "# 龙虎榜\n",
    "import tushare as ts\n",
    "import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "# current = datetime.datetime.now().strftime('%Y-%m-%d')\n",
    "current='2018-04-23'\n",
    "df = ts.top_list(current)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>code</th>\n",
       "      <th>name</th>\n",
       "      <th>pchange</th>\n",
       "      <th>amount</th>\n",
       "      <th>buy</th>\n",
       "      <th>sell</th>\n",
       "      <th>reason</th>\n",
       "      <th>bratio</th>\n",
       "      <th>sratio</th>\n",
       "      <th>date</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>000070</td>\n",
       "      <td>特发信息</td>\n",
       "      <td>-9.9701</td>\n",
       "      <td>5879.18</td>\n",
       "      <td>2801.93</td>\n",
       "      <td>3077.24</td>\n",
       "      <td>日跌幅偏离值达到7%的前五只证券</td>\n",
       "      <td>0.17</td>\n",
       "      <td>0.19</td>\n",
       "      <td>2018-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>000407</td>\n",
       "      <td>胜利股份</td>\n",
       "      <td>8.2863</td>\n",
       "      <td>3825.35</td>\n",
       "      <td>2398.34</td>\n",
       "      <td>1427.00</td>\n",
       "      <td>日涨幅偏离值达到7%的前五只证券</td>\n",
       "      <td>0.24</td>\n",
       "      <td>0.15</td>\n",
       "      <td>2018-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>000605</td>\n",
       "      <td>渤海股份</td>\n",
       "      <td>-9.9849</td>\n",
       "      <td>4613.54</td>\n",
       "      <td>913.24</td>\n",
       "      <td>3700.30</td>\n",
       "      <td>日跌幅偏离值达到7%的前五只证券</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.21</td>\n",
       "      <td>2018-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>000638</td>\n",
       "      <td>万方发展</td>\n",
       "      <td>-9.9598</td>\n",
       "      <td>889.49</td>\n",
       "      <td>484.16</td>\n",
       "      <td>405.32</td>\n",
       "      <td>日跌幅偏离值达到7%的前五只证券</td>\n",
       "      <td>0.14</td>\n",
       "      <td>0.12</td>\n",
       "      <td>2018-04-23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>000816</td>\n",
       "      <td>智慧农业</td>\n",
       "      <td>-9.7923</td>\n",
       "      <td>5115.01</td>\n",
       "      <td>1846.12</td>\n",
       "      <td>3268.88</td>\n",
       "      <td>日跌幅偏离值达到7%的前五只证券</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.09</td>\n",
       "      <td>2018-04-23</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     code  name  pchange   amount      buy     sell            reason bratio  \\\n",
       "0  000070  特发信息  -9.9701  5879.18  2801.93  3077.24  日跌幅偏离值达到7%的前五只证券   0.17   \n",
       "1  000407  胜利股份   8.2863  3825.35  2398.34  1427.00  日涨幅偏离值达到7%的前五只证券   0.24   \n",
       "2  000605  渤海股份  -9.9849  4613.54   913.24  3700.30  日跌幅偏离值达到7%的前五只证券   0.05   \n",
       "3  000638  万方发展  -9.9598   889.49   484.16   405.32  日跌幅偏离值达到7%的前五只证券   0.14   \n",
       "4  000816  智慧农业  -9.7923  5115.01  1846.12  3268.88  日跌幅偏离值达到7%的前五只证券   0.05   \n",
       "\n",
       "  sratio        date  \n",
       "0   0.19  2018-04-23  \n",
       "1   0.15  2018-04-23  \n",
       "2   0.21  2018-04-23  \n",
       "3   0.12  2018-04-23  \n",
       "4   0.09  2018-04-23  "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>code</th>\n",
       "      <th>name</th>\n",
       "      <th>pchange</th>\n",
       "      <th>amount</th>\n",
       "      <th>buy</th>\n",
       "      <th>sell</th>\n",
       "      <th>reason</th>\n",
       "      <th>bratio</th>\n",
       "      <th>sratio</th>\n",
       "      <th>date</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>002930</td>\n",
       "      <td>宏川智慧</td>\n",
       "      <td>4.8647</td>\n",
       "      <td>9892.49</td>\n",
       "      <td>4999.10</td>\n",
       "      <td>4893.40</td>\n",
       "      <td>日换手率达到20%的前五只证券</td>\n",
       "      <td>0.08</td>\n",
       "      <td>0.07</td>\n",
       "      <td>2018-04-23</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      code  name pchange   amount      buy     sell           reason bratio  \\\n",
       "24  002930  宏川智慧  4.8647  9892.49  4999.10  4893.40  日换手率达到20%的前五只证券   0.08   \n",
       "\n",
       "   sratio        date  \n",
       "24   0.07  2018-04-23  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[df['code']=='002930']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from longhuban import get_result\n",
    "dt=get_result()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%',\n",
       "  [[u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'995.8324',\n",
       "    u'0.0',\n",
       "    u'995.8324',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'1',\n",
       "    u'201977686',\n",
       "    u'\\u5149\\u5927\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6e29\\u5dde\\u5e02\\u5e9c\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'1.12',\n",
       "    u'0.0',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'967.4355',\n",
       "    u'0.0',\n",
       "    u'967.4355',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'1',\n",
       "    u'200248692',\n",
       "    u'\\u5b89\\u4fe1\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u4f5b\\u5c71\\u5357\\u6d77\\u7f57\\u6751\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'1.08',\n",
       "    u'0.0',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'855.2275',\n",
       "    u'4.5445',\n",
       "    u'850.683',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'1',\n",
       "    u'201350205',\n",
       "    u'\\u5174\\u4e1a\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u53a6\\u95e8\\u7a46\\u539d\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.96',\n",
       "    u'0.01',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'693.521963',\n",
       "    u'699.081236',\n",
       "    u'-5.559273',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'1',\n",
       "    u'201350206',\n",
       "    u'\\u5f00\\u6e90\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u897f\\u5b89\\u51e4\\u57ce\\u4e00\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.78',\n",
       "    u'0.78',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'668.214121',\n",
       "    u'245.2738',\n",
       "    u'422.940321',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'1',\n",
       "    u'201752186',\n",
       "    u'\\u8d22\\u901a\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6e29\\u5cad\\u4e2d\\u534e\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.75',\n",
       "    u'0.27',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'174.591067',\n",
       "    u'1318.5458',\n",
       "    u'-1143.954733',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'2',\n",
       "    u'200059745',\n",
       "    u'\\u534e\\u6cf0\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6df1\\u5733\\u76ca\\u7530\\u8def\\u8363\\u8d85\\u5546\\u52a1\\u4e2d\\u5fc3\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.2',\n",
       "    u'1.48',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'139.9885',\n",
       "    u'1410.800565',\n",
       "    u'-1270.812065',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'2',\n",
       "    u'200071132',\n",
       "    u'\\u4e2d\\u4fe1\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u4e0a\\u6d77\\u6052\\u4e30\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.16',\n",
       "    u'1.58',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'57.9168',\n",
       "    u'1020.971303',\n",
       "    u'-963.054503',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'2',\n",
       "    u'200848687',\n",
       "    u'\\u4e07\\u548c\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6210\\u90fd\\u901a\\u76c8\\u8857\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.06',\n",
       "    u'1.14',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'2.6314',\n",
       "    u'1696.454661',\n",
       "    u'-1693.823261',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'2',\n",
       "    u'200060397',\n",
       "    u'\\u4e07\\u548c\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6210\\u90fd\\u8700\\u6c49\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.0',\n",
       "    u'1.9',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'0.0',\n",
       "    u'1208.7428',\n",
       "    u'-1208.7428',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u6da8\\u5e45\\u504f\\u79bb\\u503c\\u8fbe7%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'2',\n",
       "    u'200904983',\n",
       "    u'\\u65b9\\u6b63\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u4e0a\\u6d77\\u897f\\u85cf\\u5357\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.0',\n",
       "    u'1.35',\n",
       "    u'89214.0']]],\n",
       " [u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%',\n",
       "  [[u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'995.8324',\n",
       "    u'0.0',\n",
       "    u'995.8324',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'1',\n",
       "    u'201977686',\n",
       "    u'\\u5149\\u5927\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6e29\\u5dde\\u5e02\\u5e9c\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'1.12',\n",
       "    u'0.0',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'967.4355',\n",
       "    u'0.0',\n",
       "    u'967.4355',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'1',\n",
       "    u'200248692',\n",
       "    u'\\u5b89\\u4fe1\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u4f5b\\u5c71\\u5357\\u6d77\\u7f57\\u6751\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'1.08',\n",
       "    u'0.0',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'855.2275',\n",
       "    u'4.5445',\n",
       "    u'850.683',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'1',\n",
       "    u'201350205',\n",
       "    u'\\u5174\\u4e1a\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u53a6\\u95e8\\u7a46\\u539d\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.96',\n",
       "    u'0.01',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'693.521963',\n",
       "    u'699.081236',\n",
       "    u'-5.559273',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'1',\n",
       "    u'201350206',\n",
       "    u'\\u5f00\\u6e90\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u897f\\u5b89\\u51e4\\u57ce\\u4e00\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.78',\n",
       "    u'0.78',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'668.214121',\n",
       "    u'245.2738',\n",
       "    u'422.940321',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'1',\n",
       "    u'201752186',\n",
       "    u'\\u8d22\\u901a\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6e29\\u5cad\\u4e2d\\u534e\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.75',\n",
       "    u'0.27',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'174.591067',\n",
       "    u'1318.5458',\n",
       "    u'-1143.954733',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'2',\n",
       "    u'200059745',\n",
       "    u'\\u534e\\u6cf0\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6df1\\u5733\\u76ca\\u7530\\u8def\\u8363\\u8d85\\u5546\\u52a1\\u4e2d\\u5fc3\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.2',\n",
       "    u'1.48',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'139.9885',\n",
       "    u'1410.800565',\n",
       "    u'-1270.812065',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'2',\n",
       "    u'200071132',\n",
       "    u'\\u4e2d\\u4fe1\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u4e0a\\u6d77\\u6052\\u4e30\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.16',\n",
       "    u'1.58',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'57.9168',\n",
       "    u'1020.971303',\n",
       "    u'-963.054503',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'2',\n",
       "    u'200848687',\n",
       "    u'\\u4e07\\u548c\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6210\\u90fd\\u901a\\u76c8\\u8857\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.06',\n",
       "    u'1.14',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'2.6314',\n",
       "    u'1696.454661',\n",
       "    u'-1693.823261',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'2',\n",
       "    u'200060397',\n",
       "    u'\\u4e07\\u548c\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6210\\u90fd\\u8700\\u6c49\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.0',\n",
       "    u'1.9',\n",
       "    u'89214.0'],\n",
       "   [u'2018-04-24',\n",
       "    u'300333',\n",
       "    u'0.0',\n",
       "    u'1208.7428',\n",
       "    u'-1208.7428',\n",
       "    u'0.0',\n",
       "    u'0.0',\n",
       "    u'\\u65e5\\u632f\\u5e45\\u503c\\u8fbe15%\\u7684\\u524d\\u4e09\\u53ea\\u8bc1\\u5238|\\u524d\\u4e94\\u53ea\\u8bc1\\u5238',\n",
       "    u'2',\n",
       "    u'200904983',\n",
       "    u'\\u65b9\\u6b63\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u4e0a\\u6d77\\u897f\\u85cf\\u5357\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8',\n",
       "    u'0.0',\n",
       "    u'1.35',\n",
       "    u'89214.0']]]]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(dt)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "buy\n",
      "OrderedDict([(u'\\u5149\\u5927\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6e29\\u5dde\\u5e02\\u5e9c\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8', u'995.8324'), (u'\\u5b89\\u4fe1\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u4f5b\\u5c71\\u5357\\u6d77\\u7f57\\u6751\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8', u'967.4355'), (u'\\u5174\\u4e1a\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u53a6\\u95e8\\u7a46\\u539d\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8', u'850.683'), (u'\\u5f00\\u6e90\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u897f\\u5b89\\u51e4\\u57ce\\u4e00\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8', u'-5.559273'), (u'\\u8d22\\u901a\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6e29\\u5cad\\u4e2d\\u534e\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8', u'422.940321')])\n",
      "\n",
      "sell\n",
      "OrderedDict([(u'\\u534e\\u6cf0\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6df1\\u5733\\u76ca\\u7530\\u8def\\u8363\\u8d85\\u5546\\u52a1\\u4e2d\\u5fc3\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8', u'-1143.954733'), (u'\\u4e2d\\u4fe1\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u4e0a\\u6d77\\u6052\\u4e30\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8', u'-1270.812065'), (u'\\u4e07\\u548c\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6210\\u90fd\\u901a\\u76c8\\u8857\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8', u'-963.054503'), (u'\\u4e07\\u548c\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u6210\\u90fd\\u8700\\u6c49\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8', u'-1693.823261'), (u'\\u65b9\\u6b63\\u8bc1\\u5238\\u80a1\\u4efd\\u6709\\u9650\\u516c\\u53f8\\u4e0a\\u6d77\\u897f\\u85cf\\u5357\\u8def\\u8bc1\\u5238\\u8425\\u4e1a\\u90e8', u'-1208.7428')])\n",
      "光大证券股份有限公司温州市府路证券营业部\n",
      "安信证券股份有限公司佛山南海罗村证券营业部\n",
      "兴业证券股份有限公司厦门穆厝路证券营业部\n",
      "开源证券股份有限公司西安凤城一路证券营业部\n",
      "财通证券股份有限公司温岭中华路证券营业部\n"
     ]
    }
   ],
   "source": [
    "from collections import OrderedDict\n",
    "# print(len(dt[0][1])\n",)
    "print('buy'\n",)
    "buy_dict=OrderedDict()\n",
    "lhb_data = dt[0][1]\n",
    "for i in range(5):\n",
    "#     print(lhb_data[i][10]\n",)
    "#     print(lhb_data[i][4]\n",)
    "    buy_dict[lhb_data[i][10]]=lhb_data[i][4]\n",
    "#     for j in i:\n",
    "#        print(j\n",)
    "print(buy_dict\n",)
    "print('\\nsell'\n",)
    "sell_dict=OrderedDict()\n",
    "for i in range(5,10):\n",
    "#     print(lhb_data[i][10]\n",)
    "#     print(lhb_data[i][4]\n",)
    "    sell_dict[lhb_data[i][10]]=lhb_data[i][4]\n",
    "    \n",
    "print(sell_dict\n",)
    "\n",
    "for i in buy_dict.keys():\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
